(deftemplate casa
	(slot nationalitate)
    (slot casa)    
)

(deftemplate animal 
	(slot nationalitate)
    (slot animal)    
)

(deftemplate tigari
	(slot nationalitate)
    (slot tigari)    
)

(foreach ?nationalitate (create$ Spaniol Englez Rus)
	(foreach ?casa (create$ stanga dreapta centru)
    	(assert (casa (nationalitate ?nationalitate) (casa ?casa))) 
    )    
)

(foreach ?nationalitate (create$ Spaniol Englez Rus)
	(foreach ?animal (create$ caine cal lup)
		(assert (animal (nationalitate ?nationalitate) (animal ?animal)))
    )		
 )  
    
(foreach ?nationalitate (create$ Spaniol Englez Rus)
    (foreach ?tigari (create$ Kent Lucky_Strike LM)
    	(assert (tigari (nationalitate ?nationalitate) (tigari ?tigari)))
    )
)

(defrule rezolvare
    (casa (nationalitate Englez) (casa stanga & ?p1)) 
   	(animal (nationalitate Enlgez) (animal ?a1))
    (tigari (nationalitate Englez) (tigari ?t1))
    
    
    (casa (nationalitate Rus) (casa ?c2))
	(animal (nationalitate Rus) (animal cal & ?a))
    (tigari (nationalitate Rus) (tigari ?t2)) 
    
    (casa (nationalitate Spaniol) (casa ?c3))
    (animal (nationalitate Spaniol) (animal ?a3))
    (tigari (nationalitate Spaniol) (tigari Kent & ?t3))
       
    =>
    
    (printout t " Englezul are un " ?a1 " si fumeaza " ?t1 " casa nr " ?c1 crlf)
	(printout t " Rusul are un " ?a2 " si fumeaza " ?t2 " casa nr " ?c2 crlf)
	(printout t " Spaniolul are un " ?a3 " si fumeaza " ?t3 " casa nr " ?c3 crlf crlf) 
    
)

(run)